/***************************************************************************
 *   Copyright (C) 2009 by Marcin Swiechowicz   *
 *   marcin.swiechowicz@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef KDCSTATUSBAR_H
#define KDCSTATUSBAR_H

#include "interfaces/kdcstatusbarinterface.h"
#include <KStatusBar>
#include <QProgressBar>
#include <QBasicTimer>
#include <QTimerEvent>
#include <QLabel>
#include "infolabel.h"

class KDCStatusBar : public KStatusBar, public KDCStatusBarInterface
{
Q_OBJECT
public:
	KDCStatusBar( QWidget *aParent = 0 );
	~KDCStatusBar();
	void showMessage( const QString &aText, KDC::MessageType aType );
	void setProjectSize( quint64 aSize, KDC::MediaSize aMediaSize );
	void setProjectOutputPath( const QString &aPath );
	void setProjectTempPath( const QString &aPath );
	void setDeleteInputFilesEnabled( bool aEnabled );
	void setDeleteTempFilesEnabled( bool aEnabled );
	void setCreateDiscStructureEnabled( bool aEnabled );
	void clear();
	void refresh();
protected:
	void timerEvent( QTimerEvent *aEvent );
private:
	void drawLabel( QLabel *aLabel, bool aEnabled );
	void refreshFreeSpace();
private slots:
	void slotFoundOutMountPoint( const QString &aMountPoint, quint64 aKBSize, quint64 aKBUsed, quint64 aKBAvail );
	void slotFoundTempMountPoint( const QString &aMountPoint, quint64 aKBSize, quint64 aKBUsed, quint64 aKBAvail );
private:
	QString pOutMountPoint;
	QString pTempMountPoint;
	quint64 pProjectSize;
	InfoLabel *pInfoLabel;
	QProgressBar *pDiscSizeBar;
	QLabel *pCreateStructureLabel;
	QLabel *pDeleteTempFilesLabel;
	QLabel *pDelOryginalFilesLabel;
	QLabel *pOutFolderIcon;
	QLabel *pOutFolderInfo;
	QLabel *pTempFolderIcon;
	QLabel *pTempFolderInfo;
	QBasicTimer *pTimer;
};
#endif
